/**
 * Created by lovelysong on 17-4-21.
 */
import java.util.Scanner;

public class Complex {
    double RealPart;
    double ImagePart;
    public Complex(){
        this.ImagePart=0;
        this.RealPart=0;
    }
    public Complex(double RealPart, double ImagePart) {
        this.RealPart = RealPart;
        this.ImagePart = ImagePart;
    }
    public  double getRealPart(){
        return this.RealPart;
    }
    public double getImagePart(){
        return this.ImagePart;
    }

    public double setRealPart(double R){
        this.RealPart = R;
        return R;
    }
    public double setImagePart(double I){
        this.ImagePart = I;
        return I;
    }
    Complex ComplexAdd(Complex a){
        double R = a.getRealPart();
        double I = a.getImagePart();
        double cr = R + this.RealPart;
        double ci = I + this.ImagePart;
        Complex c = new Complex(cr,ci);
        return c;
    }
    Complex ComplexSub(Complex a){
        double R = a.getRealPart();
        double I = a.getImagePart();
        double cr = R - this.RealPart;
        double ci = I - this.ImagePart;
        Complex c = new Complex(cr,ci);
        return c;
    }
    Complex ComplexMultib(Complex a){
        double R = a.getRealPart();
        double I = a.getImagePart();
        double cr = R * this.RealPart;
        double ci = I * this.ImagePart;
        Complex c = new Complex(cr,ci);
        return c;
    }
    Complex ComplexDiv(Complex a){
        double R = a.getRealPart();
        double I = a.getImagePart();
        double cr = R / this.RealPart;
        double ci = I / this.ImagePart;
        Complex c = new Complex(cr,ci);
        return c;
    }
    public String toString() {
        String complex=new String();
        if (ImagePart > 0)
            complex = "(" + RealPart + "+" + ImagePart + "i" + ")";
        if (ImagePart == 0)
            complex = "(" + RealPart + ")" ;
        if (ImagePart < 0)
            complex = "(" + RealPart + "-" + ImagePart + "i" + ")";
        return complex;
    }
}